<?php
function getFormattedDate($unixtime)
{
	$day = elgg_echo(strtolower(date('l',$unixtime)));
	$month = elgg_echo(strtolower(date('F',$unixtime)));
	
	$string = $day.' '.date('d',$unixtime).' ';
	$string.= $month.' ';
	$string.= date('Y H:i',$unixtime);
	
	return $string;
}

$tournament = $vars['entity'];
$org = $tournament->getOrganization();
$inscriptionStartDate = $tournament->inscription_date_start + $tournament->inscription_seconds_start;
$inscriptionEndDate = $tournament->inscription_date_end + $tournament->inscription_seconds_end;

?>
<style>
	tr > td:first-child
	{
		font-weight: bold;
	}
	td
	{
		padding: 5px;
	}
</style>
<div class="elgg-module  elgg-module-featured">
	<!--<div class="elgg-head"></div>-->
	<div class="elgg-body">
		<table width="450">
			<tr>
				<td width=200>Torneo organizado por</td>
				<td>
					<?php 
						echo elgg_view('output/url', array('text' => $org->title, 'href' => $org->getUrl()));
					?>
				</td>
			</tr>
			<tr>
				<td>Inscripciones desde</td>
				<td>
					<?php echo getFormattedDate($inscriptionStartDate); ?>
				</td>
			</tr>
			<tr>
				<td>Inscripciones hasta</td>
				<td>
					<?php echo getFormattedDate($inscriptionEndDate); ?>
				</td>
			</tr>
			<tr class="see_more" style="display:none;">
				<td>Precio inscripci&oacute;n</td>
				<td>
					<?php echo $tournament->price; ?> euros
				</td>
			</tr>
			<tr class="see_more" style="display:none;">
				<td>Precio inscripci&oacute;n</td>
				<td>
					<?php echo $tournament->price; ?> euros
				</td>
			</tr>
			<tr class="see_more" style="display:none;">
				<td>Precio inscripci&oacute;n</td>
				<td>
					<?php echo $tournament->price; ?> euros
				</td>
			</tr>
			<tr class="see_more" style="display:none;">
				<td>Precio inscripci&oacute;n</td>
				<td>
					<?php echo $tournament->price; ?> euros
				</td>
			</tr>
		</table>
		<div id="see_more_button" style="float:right" class="elgg-button elgg-button-action">Ver mas...</div>
		<script type="text/javascript">
		$("#see_more_button").click(function()
		{
			if($('.see_more').css('display') == 'none')
			{
				$('.see_more').show();
				$(this).html("Ver menos");
			}
			else
			{
				$('.see_more').hide();
				$(this).html("Ver mas...");
			}
		});
		</script>
	</div>
</div>
<?php echo elgg_view('frontend/view/tabs', $vars); ?>
<br>
<?php echo $tournament->description; ?>